<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
       .box {
      position: relative;
      width: 230px;
      height: 170px;
      background-color: #fff;
      margin: 100px auto;
      text-align: center;
      font-size: 50px;
      line-height: 200px;
      font-weight: 700;
      /* display: none; */
    }

    .box1 {
        /* 绝对定位 */
      position: absolute;
      /* position: relative; */
      right: 20px;
      top: 1px;
      width: 20px;
      height: 20px;
      background-color: skyblue;
      text-align: center;
      line-height: 20px;
      font-size: 16px;
      /* 鼠标移动到上方时,改变鼠标样式 */
      cursor: pointer;
    }
    </style>
</head>
<body>
    <div class="box">
        <img src="./images/tao.png" alt="">
        <div class="box1">X</div>
    </div>
    <script>
        // 获取元素
        const box1 = document.querySelector('.box1');
        // console.log(box1);

        // 注册事件
        box1.addEventListener('click',()=>{
            // 关闭大盒子
            box1.parentNode.style.display = 'none';
        });

    </script>
</body>
</html>